<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Boost 搜索引擎</title>
    <style>
        /* 字体系统 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        }

        body {
            background: #f8f9ff;
            min-height: 100vh;
        }

        /* 容器布局 */
        .container {
            width: 90%;
            max-width: 800px;
            margin: 40px auto;
            padding: 0 15px;
        }

        /* 搜索框区域 */
        .search-box {
            position: relative;
            box-shadow: 0 8px 32px rgba(78, 110, 242, 0.12);
            border-radius: 50px;
            background: white;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .search-box:hover {
            transform: translateY(-2px);
        }

        /* 输入框样式 */
        #searchInput {
            width: 100%;
            height: 60px;
            padding: 0 30px;
            border: none;
            border-radius: 50px;
            font-size: 18px;
            color: #2d3748;
            background: transparent;
            transition: all 0.3s;
        }

        #searchInput:focus {
            outline: none;
            box-shadow: 0 0 0 3px rgba(78, 110, 242, 0.2);
        }

        /* 搜索按钮 */
        #searchBtn {
            position: absolute;
            right: 5px;
            top: 5px;
            height: 50px;
            padding: 0 30px;
            border: none;
            border-radius: 40px;
            background: linear-gradient(135deg, #667eea 0%, #4e6ef2 100%);
            color: white;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
        }

        #searchBtn:hover {
            transform: scale(0.98);
            box-shadow: 0 4px 12px rgba(78, 110, 242, 0.25);
        }

        /* 搜索结果区域 */
        .result {
            margin-top: 30px;
        }

        .result-item {
            background: white;
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 20px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
            transition: all 0.3s;
        }

        .result-item:hover {
            transform: translateX(10px);
            box-shadow: 0 10px 15px -3px rgba(78, 110, 242, 0.1);
        }

        .result-item a {
            font-size: 20px;
            color: #2d3748;
            text-decoration: none;
            font-weight: 600;
            display: inline-block;
            margin-bottom: 8px;
            background: linear-gradient(90deg, #4e6ef2 0%, #667eea 100%);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .result-item p {
            color: #718096;
            line-height: 1.6;
            margin: 12px 0;
            font-size: 16px;
        }

        .result-item i {
            display: block;
            color: #48bb78;
            font-size: 14px;
            font-style: normal;
            word-break: break-all;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            #searchInput {
                height: 52px;
                padding: 0 20px;
                font-size: 16px;
            }

            #searchBtn {
                height: 44px;
                padding: 0 20px;
                font-size: 14px;
            }

            .result-item {
                padding: 18px;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="search-box">
            <input type="text" id="searchInput" placeholder="示例：filesystem">
            <button id="searchBtn" onclick="Search()">搜索</button>
        </div>
        <div class="search-link">
            <a href="https://gitee.com/Index194/boost_searcher" target="_blank">项目源码</a>
        </div>
        <div class="result"></div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        // JS后端交互功能
        function Search() {
            let query = $("#searchInput").val();
            $.ajax({
                type: "GET",
                url: "/s?word=" + query,
                success: function (data) {
                    BuildHtml(data);
                }
            });
        }

        function BuildHtml(data) {
            let result_lable = $(".result");
            result_lable.empty();
            data.forEach(elem => {
                result_lable.append(`
                    <div class="result-item">
                        <a href="${elem.url}" target="_blank">${elem.title}</a>
                        <p>${elem.desc}</p>
                        <i>${elem.url}</i>
                    </div>
                `);
            });
        }

        // 输入框交互
        $("#searchInput").on("focus", function () {
            $(this).attr("placeholder", "");
        }).on("blur", function () {
            $(this).attr("placeholder", "示例：filesystem");
        });
    </script>
</body>

</html>